package cn.wolfcode.crm.web.controller;

import cn.wolfcode.crm.domain.RechargeBill;
import cn.wolfcode.crm.query.QueryObject;
import cn.wolfcode.crm.service.IRechargeBillService;
import cn.wolfcode.crm.util.JsonResult;
import cn.wolfcode.crm.util.PageResult;
import cn.wolfcode.crm.util.PermissionName;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author 丧彪
 */
@Controller
@RequestMapping("rechargeBill")
public class RechargeBillController {
    @Autowired
    private IRechargeBillService rechargeBillService;
    
    
    @RequiresPermissions("rechargeBill:list")
    @PermissionName("充值记录列表")
    @RequestMapping("list")
    @ResponseBody
    public PageResult list(QueryObject qo){
        return rechargeBillService.query(qo);
    }
    
    
    @RequiresPermissions("rechargeBill:save")
    @PermissionName("充值记录保存")
    @RequestMapping("save")
    @ResponseBody
    public JsonResult save(RechargeBill entity){
    	JsonResult result = new JsonResult();
    	try {
    		rechargeBillService.save(entity);
		} catch (Exception e) {
			e.printStackTrace();
			result.markMsg("充值失败!");
		}
        return result;
    }

}
